home *** CD-ROM | disk | FTP | other *** search
/ Mac Format 1995 June / MacFormat 25.iso / Shareware City / Developers / OutOfPhase1.1 Source / OutOfPhase Folder / ASTBinaryOperator.h < prev    next >
Text File  |  1994-05-07  |  2KB  |  81 lines

  1. /* ASTBinaryOperator.h */
  2.  
  3. #ifndef Included_ASTBinaryOperator_h
  4. #define Included_ASTBinaryOperator_h
  5.  
  6. /* ASTBinaryOperator module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* ASTExpression */
  12. /* TrashTracker */
  13. /* Memory */
  14. /* PcodeObject */
  15. /* CompilerRoot */
  16. /* PromotableTypeCheck */
  17.  
  18. #include "PcodeObject.h"
  19. #include "CompilerRoot.h"
  20.  
  21. struct ASTBinaryOpRec;
  22. typedef struct ASTBinaryOpRec ASTBinaryOpRec;
  23.  
  24. /* all memory allocated in this module is through TrashTracker */
  25.  
  26. /* binary operator operations */
  27. typedef enum
  28.     {
  29.         eBinaryAnd EXECUTE(= -6623),
  30.         eBinaryOr,
  31.         eBinaryXor,
  32.         eBinaryLessThan,
  33.         eBinaryLessThanOrEqual,
  34.         eBinaryGreaterThan,
  35.         eBinaryGreaterThanOrEqual,
  36.         eBinaryEqual,
  37.         eBinaryNotEqual,
  38.         eBinaryPlus,
  39.         eBinaryMinus,
  40.         eBinaryMultiplication,
  41.         eBinaryImpreciseDivision,
  42.         eBinaryIntegerDivision,
  43.         eBinaryIntegerRemainder,
  44.         eBinaryShiftLeft,
  45.         eBinaryShiftRight,
  46.         eBinaryArraySubscripting,
  47.         eBinaryExponentiation,
  48.         eBinaryResizeArray
  49.     } BinaryOpType;
  50.  
  51. /* forwards */
  52. struct TrashTrackRec;
  53. struct ASTExpressionRec;
  54.  
  55. /* create a new binary operator */
  56. ASTBinaryOpRec*            NewBinaryOperator(BinaryOpType Operation,
  57.                                             struct ASTExpressionRec* LeftArgument,
  58.                                             struct ASTExpressionRec* RightArgument,
  59.                                             struct TrashTrackRec* TrashTracker, long LineNumber);
  60.  
  61. /* type check the binary operator node.  this returns eCompileNoError if */
  62. /* everything is ok, and the appropriate type in *ResultingDataType. */
  63. CompileErrors                TypeCheckBinaryOperator(DataTypes* ResultingDataType,
  64.                                             ASTBinaryOpRec* BinaryOperator, long* ErrorLineNumber,
  65.                                             struct TrashTrackRec* TrashTracker);
  66.  
  67. /* find out just what kind of binary operation this is */
  68. BinaryOpType                BinaryOperatorWhichOne(ASTBinaryOpRec* TheBinOp);
  69.  
  70. /* get the left hand side operand out of a binary operator record */
  71. struct ASTExpressionRec*    GetLeftOperandForBinaryOperator(ASTBinaryOpRec* TheBinOp);
  72.  
  73. /* get the right hand side operand out of a binary operator record */
  74. struct ASTExpressionRec*    GetRightOperandForBinaryOperator(ASTBinaryOpRec* TheBinOp);
  75.  
  76. /* generate code for a binary operator.  returns True if successful, or False if it fails. */
  77. MyBoolean                        CodeGenBinaryOperator(struct PcodeRec* FuncCode,
  78.                                             long* StackDepthParam, ASTBinaryOpRec* BinaryOperator);
  79.  
  80. #endif
  81.